package gui.houseeditor;

public class DefaultHouseModel extends AbstractHouseModel {

    private HouseObject[][] matrix;
    
    public DefaultHouseModel(int w,int h){
        super(w,h);
        matrix=new HouseObject[height][width];
        for(int i=0;i<height;i++)
            for(int j=0;j<width;j++)
                matrix[i][j]=HouseObject.BLANK;
        
    }

    @Override
    public HouseObject getCell(int x, int y) {
        return matrix[x][y];
    }

   
    @Override
    public void setCell(HouseObject o, int x, int y) {
        
            matrix[x][y]=o;
            fireValueChanged(this,x,y);
    }
    
    public void clear(){
        for(int i=0;i<height;i++)
            for(int j=0;j<width;j++){
                setCell(HouseObject.BLANK,i,j);
                fireValueChanged(this,i,j);
            }
    }
}
